/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean;

import java.io.Serializable;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import org.primefaces.model.chart.PieChartModel;
import sessions.GestionnaireUtilisateur;

/**
 *
 * @author Mic
 */
@Named(value = "chartBean")
@SessionScoped
public class ChartBean implements Serializable {  
  
    private PieChartModel pieModel;
    private static double nbClients;
    private static double nbCommercants;
    
    @EJB
    private static GestionnaireUtilisateur gestionnaireUtilisateur;
    
    public ChartBean() {  
        createPieModel();  
    }  
  
    public PieChartModel getPieModel() {  
        return pieModel;  
    }

    public static double getNbClients() {
        return nbClients;
    }

    public static void setNbClients(double nbClients) {
        ChartBean.nbClients = nbClients;
    }

    public static double getNbCommercants() {
        return nbCommercants;
    }

    public static void setNbCommercants(double nbCommercants) {
        ChartBean.nbCommercants = nbCommercants;
    }
  
    private void createPieModel() {  
        pieModel = new PieChartModel();  
       
        pieModel.set("Client", ChartBean.getNbClients());  
        pieModel.set("Commercant", ChartBean.getNbCommercants());  
         
    }  
    
    public static void setDataChart(double nbCli, double nbCom)
    {
        ChartBean.setNbClients(nbCli);
        ChartBean.setNbCommercants(nbCom);
    }
}  
